#ifndef OBJECT3D_CPP
#define OBJECT3D_CPP

#include "object3d.h"

#include <assert.h>

CObject3D::CObject3D(const CObject3D& copy):   m_pGlobalManager(copy.m_pGlobalManager),
//                                            m_mesh_manager_ptr(copy.m_mesh_manager_ptr),
//                                            m_sound_manager_ptr(copy.m_sound_manager_ptr),
                                            m_position(copy.m_position),
                                            m_rotation(copy.m_rotation)
{
// for the position tracker
    if ( copy.m_pos_tracker_ptr != NULL )
    {
        switch ( copy.m_pos_tracker_ptr->myBehaviour() ) // here we recreate a design strategy pattern
        {
        case TrajectoryCalculator<double>::STRAIGHT:
            m_pos_tracker_ptr = new StraightLine<double>;
        break;
        case TrajectoryCalculator<double>::PARABOLIC_DOWN:
            m_pos_tracker_ptr = new ParabolicDown<double>;
        break;
        case TrajectoryCalculator<double>::PARABOLIC_UP:
            m_pos_tracker_ptr = new ParabolicUp<double>;
        break;
        default:
            assert(false&&"Error in CObject3D copy constructor");
        break;
        }
    }
    else
    {
        m_pos_tracker_ptr = NULL;
    }
// for the rotation tracker
    if ( copy.m_rot_tracker_ptr != NULL )
    {
        switch ( copy.m_rot_tracker_ptr->myBehaviour() ) // here we recreate a design strategy pattern
        {
        case TrajectoryCalculator<double>::STRAIGHT:
            m_rot_tracker_ptr = new StraightLine<double>;
        break;
        case TrajectoryCalculator<double>::PARABOLIC_DOWN:
            m_rot_tracker_ptr = new ParabolicDown<double>;
        break;
        case TrajectoryCalculator<double>::PARABOLIC_UP:
            m_rot_tracker_ptr = new ParabolicUp<double>;
        break;
        default:
            assert(false&&"Error in CObject3D copy constructor");
        break;
        }
    }
    else
    {
        m_rot_tracker_ptr = NULL;
    }
}

CObject3D::~CObject3D()
{
    delete m_pos_tracker_ptr; m_pos_tracker_ptr = NULL;
    delete m_rot_tracker_ptr; m_rot_tracker_ptr = NULL;
}

#endif //OBJECT3D_CPP
